﻿using UnityEngine;
using System.Collections;

[ExecuteInEditMode]
public class LightmapAutoSetter : MonoBehaviour {

	public Texture2D[] lightmaps;

	// Use this for initialization
	void Start () {
		int count = lightmaps != null ? lightmaps.Length : 0;
		LightmapData[] datas = new LightmapData[count];
		for (int i = 0; i < count; ++i)
		{
			datas[i] = new LightmapData();
			datas[i].lightmapColor = lightmaps[i];
		}
		LightmapSettings.lightmapsMode = LightmapsMode.NonDirectional;
		LightmapSettings.lightmaps = datas;
	}

#if UNITY_EDITOR
	void OnEnable()
	{
		Start();
	}

#endif

}
